package cn.phecda.boot.common.sensitive;

import java.util.function.Function;

/**
 * <p> TODO </p>
 *
 * @author : wanpinwei
 */
public enum SensitiveStrategy {

    /**
     * 中文姓名
     */
    CHINESE_NAME(SensitiveFunctions.CHINESE_NAME),

    /**
     * 身份证号
     */
    ID_CARD_NUM(SensitiveFunctions.ID_CARD_NUM),

    /**
     * 座机号
     */
    FIXED_PHONE(SensitiveFunctions.FIX_PHONE),

    /**
     * 手机号
     */
    MOBILE_PHONE(SensitiveFunctions.MOBILE_PHONE),

    /**
     * 家庭地址
     */
    ADDRESS(SensitiveFunctions.ADDRESS),

    /**
     * 邮箱地址
     */
    EMAIL(SensitiveFunctions.EMAIL),

    /**
     * 密码
     */
    PASSWORD(SensitiveFunctions.PASSWORD),

    /**
     * 车牌号（中国）
     */
    CAR_LICENSE(SensitiveFunctions.CAR_LICENSE),

    /**
     * 银行卡号
     */
    BANK_CARD(SensitiveFunctions.BACK_CARD),

    /**
     * IPV4
     */
    IPV4(SensitiveFunctions.IPV4),

    /**
     * IPV6
     */
    IPV6(SensitiveFunctions.IPV6),

    /**
     * 只显示第一个字符
     */
    FIRST_MASK(SensitiveFunctions.FIRST_MASK),

    BASE64(SensitiveFunctions.BASE64),

    EMPTY(SensitiveFunctions.EMPTY);

    private final Function<SensitiveMetaDataWrapper, String> function;

    SensitiveStrategy(Function<SensitiveMetaDataWrapper, String> function) {
        this.function = function;
    }

    public String apply(SensitiveMetaDataWrapper wrapper) {
        return function.apply(wrapper);
    };
}
